package cn.muqingfeng.api.to;

import java.util.ArrayList;
import java.util.List;

import com.google.gson.annotations.SerializedName;

import android.os.Parcel;
import android.os.Parcelable;

public class ArticleListTO implements Parcelable {

	@SerializedName("forum_threadlist")
	private List<ArticleTO> articles;

	@SerializedName("tpp")
	private int pageSize;

	@SerializedName("page")
	private int currentPage;

	@SerializedName("forum")
	private Forum forum;

	public ArticleListTO() {
	}

	public ArticleListTO(Parcel source) {
		this.articles = new ArrayList<ArticleTO>();
		source.readTypedList(articles, ArticleTO.CREATOR);
		this.pageSize = source.readInt();
		this.currentPage = source.readInt();
		this.forum = source.readParcelable(Forum.class.getClassLoader());
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeTypedList(articles);
		dest.writeInt(pageSize);
		dest.writeInt(currentPage);
		dest.writeParcelable(forum, flags);
	}

	public static final Creator<ArticleListTO> CREATOR = new Creator<ArticleListTO>() {

		@Override
		public ArticleListTO[] newArray(int size) {
			return new ArticleListTO[size];
		}

		@Override
		public ArticleListTO createFromParcel(Parcel source) {
			return new ArticleListTO(source);
		}
	};

	public List<ArticleTO> getArticles() {
		return articles == null ? new ArrayList<ArticleTO>() : articles;
	}

	public void setArticles(List<ArticleTO> articles) {
		this.articles = articles;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public Forum getForum() {
		return forum;
	}

	public void setForum(Forum forum) {
		this.forum = forum;
	}

}
